<?php
$bankService = new BankServices();
switch ($action) {
	case "addBank":
		if($permit == true)
		{
		 	$data = array();
			foreach ($_POST as $key => $value) {
				$data[$key] = $value;
			}
			$bankDomain = new BankDomain($data);
			$bankService->create($context, $result, $bankDomain);
			header("Location:index.php?func=bank&opt=bankList");
		}
		else 
			header("Location:index.php?func=dash");
	break;
	
	case "editBank":
		if($permit == true)
		{
			$data = array();
			foreach ($_POST as $key => $value) {
				$data[$key] = $value;
			}
			$bankDomain = new BankDomain($data);
			$bankService->updateBank($context, $result, $bankDomain);
			header("Location:index.php?func=bank&opt=bankList");
		}
		else 
			header("Location:index.php?func=dash");
	break;
	
	case "deleteBank":
		if($permit == true)
		{
			if(isset($_GET['id']))
			{						
				$bankService->deleteByOid($context, $result, $_GET['id']);
				header("Location:index.php?func=bank&opt=bankList");
			}
		}
		else
			header("Location:index.php?func=dash");
	break;
	
	default:
		echo "khong co tinh nang nay";
	break;
}
?>			